package me.mayt.wxfl.web.controller;

import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping(value="/jd")
public class JdController {
	
	private static final Logger LOGGER = LoggerFactory.getLogger(JdController.class);
	
	@ResponseBody
    @RequestMapping(value = "return", method = RequestMethod.GET, produces = "text/plain;charset=utf-8")
    public String authGet(@RequestParam(value = "code", required = false) String code,
                          @RequestParam(value = "state", required = false) String state,
                          @RequestParam(value = "error", required = false) String error,
                          @RequestParam(value = "error_description", required = false) String errorDescription) {
      LOGGER.info("\n接收到来自JD服务器的回调：[{}, {}, {}, {}]", code, state, error, errorDescription);

      return "ok";
    }

}
